﻿using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;
using WMS.Seven.zhangduo.Dto;
using WMS.Seven.zhangduo.ReturnGoods;

namespace WMS.Seven.Web.Controllers.zdController
{
    public class ReturnGoodsController : Controller
    {
        public readonly ReturnGoodsService _service;
        public ReturnGoodsController(ReturnGoodsService service)
        {
            _service = service;
        }
        public IActionResult Index()
        {
            return View();
        }
        /// <summary>
        /// 显示退货销售
        /// </summary>
        /// <returns></returns>
        public IActionResult ShowReturnGoods()
        {
            return View();
        }
        /// <summary>
        /// 显示退货信息
        /// </summary>
        /// <returns></returns>
        public IActionResult GetReturnGood()
        {
            return View();
        }
        /// <summary>
        /// 显示退货信息
        /// </summary>
        /// <param name="SalesOrderCode">退货单号</param>
        /// <param name="ProductCode">销售单号</param>
        /// <param name="ProductName">产品单号</param>
        /// <returns>返回退货信息列表</returns>
        [HttpGet]
        public Task<string> GetReturnService(string? SalesOrderCode, string? ProductCode, string? ProductName)
        {
            var ityem=_service.GetReturnService(SalesOrderCode,ProductCode, ProductName);
            return ityem;
        }

        /// <summary>
        /// 显示单个退货信息
        /// </summary>
        /// <param name="id">id</param>
        /// <returns>返回退货信息实体</returns>
        [HttpGet]
        public Task<ReturnGoodsDto> ReturnGood(int id)
        {
            var model=_service.GetReturnGood(id);
            return model;
        }

        /// <summary>
        /// 删除退货信息
        /// </summary>
        /// <param name="id">实体id</param>
        /// <returns>返回受影响行数</returns>
        [HttpGet]
        public async Task<int> DelReturnGood(int id)
        {
            var relust=await _service.DelReturnGood(id);
            return relust;
        }
    }
}
